All Questions
Tagged with functional-programmingpython
122 questions
3votes
2answers
185views
Map coloring algorithm functional implementation in python
I'm an autodidact working on map coloring algorithms with backtracking, see chapter 2 of this book. I tested this implementation with success but I'm still unsure whether it is tricking me somewhere, ...
4votes
4answers
1kviews
Merging sorted integer arrays (without duplicates)
I have written a Python function called merge_arrays which takes two lists and returns the new list merge without duplicate. The function works as expected, but my ...
1vote
2answers
68views
Imrove performance when updating DataFrame rows based on complex criteria
My question got rejected the last time so I am trying a better approach to getting a solution: ...
1vote
2answers
610views
Removing Elements from an Array Based on a Second Array
I've written a function that takes two arrays of integers as input and removes all the elements in the first array that are also present in the second array. I would like to share my code with you and ...
1vote
1answer
58views
Optimizing the Dig Pow function
I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
7votes
5answers
1kviews
Optimizing a function to find the closest multiple of 10
I have written a Python function called closest_multiple_10() which takes an integer as input and returns the closest multiple of 10. The function works as expected,...
3votes
0answers
75views
A Haskell-style "maybe" type in Python, version 2
I have decided on a preferred solution to my question A maybe type in Python. Which implementation is best?, and have expanded it to be more ergonomic. I have implemented a host of utility functions (...
-2votes
1answer
1kviews
Create a function with two parameters: a list and a string, where the string has the following values [closed]
I tried so many things to do this task. I have no idea why doesn't it work. Please help! ...
3votes
2answers
742views
MP3 Playlist Class in Python
Background Info I am an intermediate level Python programmer. This is my implementation of a MP3 Playlist class challenge that was hosted on 101 Computing.Net. The ...
1vote
2answers
107views
UPDATE on Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation. Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused. Post 2 of 3, CLI: UPDATE 1 on Newspaper ...
2votes
1answer
121views
Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation. Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused. Post 2 of 3, CLI: Newspaper Bill ...
1vote
1answer
274views
Fizzbuzz Solution - complexity, readability, performance, lines, obfuscation... - .sort()
The fizzbuzz challenge presents a lot of interesting questions for 'intermediate' programmers like myself. I have found that I don't actually know where to draw the line with, complex (hard to read ...
4votes
1answer
164views
Functools extension library
I wrote a utility library inspired by functools that adds some common operations on functions I frequently use in my projects. As usual I'd appreciate any feed back....
2votes
2answers
1kviews
Improving the Conway's Game of Life Code With Functions in Python
This query is a part of Conway’s game of life. Currently, this program takes about 70 lines of code in Python to return the functionality of the game, which can be simplified to fewer lines of code ...
2votes
1answer
356views
Garden simulator [closed]
I tried to write the program so that it runs without error but I want to improve the program so that it follows the Single Responsibility Principle. What changes can I make to improve this program? I ...